home *** CD-ROM | disk | FTP | other *** search
- #include <stdarg.h>
- #include <string.h>
- #include <ctype.h>
-
- #include "DeskLib:Event.h"
-
- #include "Shell.SafeAlloc.h"
- #include "Shell.TextRect.h"
- #include "Shell.Printf.h"
-
-
-
- void Shell_Printf( const char *fmt, ...)
- { va_list args;
- va_start( args, fmt);
- vsprintf( Shell_string, fmt, args);
- va_end( args);
- Shell_TextRectPrint( NULL, Shell_string);
- }
-
-
-
-
-
-
-
-
- static BOOL Shell_WaitPrintfNullHandler( event_pollblock *event, void *reference)
- {
- UNUSED( event);
- Shell_TextRectPrint( NULL, (char *) reference);
- Event_Release( event_NULL, event_ANY, event_ANY, Shell_WaitPrintfNullHandler, reference);
- free( reference);
- return TRUE;
- }
-
-
-
-
- void Shell_WaitPrintf( const char *fmt, ...)
- /* You can call this anytime, even inside a redraw function. */
- { va_list args;
- char *text;
-
- va_start( args, fmt);
- vsprintf( Shell_string, fmt, args);
- va_end( args);
-
- text = Shell_SafeMalloc( 1 + strlen( Shell_string));
- strcpy( text, Shell_string);
-
- Event_Claim( event_NULL, event_ANY, event_ANY, Shell_WaitPrintfNullHandler, (void *) text);
- /* Shell_WaitPrintfNullHandler will Event_Release itself when it is called and then */
- /* free the malloc-ed memoy 'text', so the data gets printed just once. */
- /* Isn't Event_* wonderful ? */
- }
-
-
-
- void Shell_SafeWaitPrintf( const char *fmt, ...)
- { va_list args;
- char *text, *c;
-
- va_start( args, fmt);
- vsprintf( Shell_string, fmt, args);
- va_end( args);
-
- text = Shell_SafeMalloc( 1 + strlen( Shell_string));
- strcpy( text, Shell_string);
-
- for ( c=text; *c; c++) if ( iscntrl(*c) && *c!='\n' && *c!='\0') *c = 'ยค';
-
- Event_Claim( event_NULL, event_ANY, event_ANY, Shell_WaitPrintfNullHandler, (void *) text);
- }
-
-